Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.error
Class FilePosition

    java.lang.Object
      rdlc.error.FilePosition

All Implemented Interfaces:
  ErrorLocation

    public class FilePosition

extends java.lang.Object
implements ErrorLocation

Records a file position. Stores the line and column as well as the name of the file. Also includes the code for packing and unpacking file positions into `int`s, as required for compatibility with CUP positions.

Version:
  $Revision: 1.5 $
Author:
  Greg Gibeling

Field Summary
`protected int` | `col` The column number.
`protected java.lang.String` | `fileName` The name of the file this position is in.
`protected int` | `line` The line number.

Constructor Summary
`FilePosition(FilePosition other)` Copy constructor.
`FilePosition(int _line, int _col, java.lang.String _fileName)` Base constructor, creates a new FilePosition, from its constituent data.
`FilePosition(int position, java.lang.String _fileName)` Base constructor, decodes the single int position and creates a FilePosition object.

Method Summary
`static int` | `decodeCol(int position)` Decode a column from a single integer.
`static int` | `decodeLine(int position)` Decode a line from a single integer.
`static int` | `encode(int line, int col)` Encode a line and column into a single int.
`boolean` | `equals(FilePosition other)` Check if the `other` `FilePosition` indicates the same position in the same file as this one.
`boolean` | `equals(int other)` Check if the `other` encoded file position indicates the same position as this one.
`int` | `getColumn()` Simple accessor.
`int` | `getLine()` Simple accessor.
`int` | `hashCode()` Simple accessor.
`java.lang.String` | `locationName()` Simple accessor.
`FilePosition` | `max(FilePosition other)` Determines the larger (later) of these two file positions.
`FilePosition` | `min(FilePosition other)` Returns the smaller (earlier) of these two file positions.
`java.lang.String` | `toString()` Creates a standard human readable version of this object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### line

    protected int line

  The line number.

### col

    protected int col

  The column number.

### fileName

    protected java.lang.String fileName

  The name of the file this position is in.

Constructor Detail

### FilePosition

    public FilePosition(int _line,
                        int _col,
                        java.lang.String _fileName)

  Base constructor, creates a new FilePosition, from its constituent data.

  Parameters:
    `_line` - The line number.
    `_col` - The column number.
    `_fileName` - The file name.

### FilePosition

    public FilePosition(int position,
                        java.lang.String _fileName)

  Base constructor, decodes the single int position and creates a FilePosition object.

  Parameters:
    `position` - A single int created by `FilePosition.encode()`.
    `_fileName` - The file name.
  See Also:
    `encode(int, int)`

### FilePosition

    public FilePosition(FilePosition other)

  Copy constructor.

  Parameters:
    `other` - The other FilePosition to copy.

Method Detail

### encode

    public static int encode(int line,
                             int col)

  Encode a line and column into a single int. Required for use with CUP.

  Parameters:
    `line` - The line number.
    `col` - The column number.
  Returns:
    A single int including the line and col.
  See Also:
    `decodeLine(int)`, `decodeCol(int)`

### decodeLine

    public static int decodeLine(int position)

  Decode a line from a single integer. Required for use with CUP.

  Parameters:
    `position` - The int to decode.
  Returns:
    The line which was encoded in the position.
  See Also:
    `encode(int, int)`, `decodeCol(int)`

### decodeCol

    public static int decodeCol(int position)

  Decode a column from a single integer. Required for use with CUP.

  Parameters:
    `position` - The int to decode.
  Returns:
    The column which was encoded in the position.
  See Also:
    `encode(int, int)`, `decodeLine(int)`

### toString

    public java.lang.String toString()

  Creates a standard human readable version of this object. This is used primarily during error reporting.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    Standard human readable file position.
  See Also:
    `Error.toString()`

### hashCode

    public int hashCode()

  Simple accessor.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    A simple hash code from this file position.
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(FilePosition other)

  Check if the `other` `FilePosition` indicates the same position in the same file as this one.

  Parameters:
    `other` - The other file position to check.
  Returns:
    `true` if these two `FilePositions` indicate the same position in the same file.

### equals

    public boolean equals(int other)

  Check if the `other` encoded file position indicates the same position as this one. Note that we cannot check that it is in the same file, since we are not given a file name.

  Parameters:
    `other` - The other file position to check.
  Returns:
    `true` if the other parameter indicates the same position.
  See Also:
    `encode(int, int)`

### min

    public FilePosition min(FilePosition other)

  Returns the smaller (earlier) of these two file positions. Note that if they do not indicate positions in the same file, this one will be returned by default.

  Parameters:
    `other` - The other file position.
  Returns:
    Whichever `FilePosition` indicates the first character in the file.

### max

    public FilePosition max(FilePosition other)

  Determines the larger (later) of these two file positions. Note that if they do not indicate positions in the same file, this one will be returned by default.

  Parameters:
    `other` - The other file position.
  Returns:
    Whichever `FilePosition` indicates the second character in the file.

### locationName

    public java.lang.String locationName()

  Simple accessor.

  Specified by:
    `locationName` in interface `ErrorLocation`
  Returns:
    A human readable representation of this file position.
  See Also:
    `toString()`, `ErrorLocation.locationName()`, `Error.toString()`

### getLine

    public int getLine()

  Simple accessor.

  Returns:
    The line which this `FilePosition` indicates.

### getColumn

    public int getColumn()

  Simple accessor.

  Returns:
    The column which this `FilePosition` indicates.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD